package com.itheima.myshopuser;

/**
 * @File: SwaggerConfig
 * @Brief: 用户微服务配置类
 * @Details:
 * @Author: Kevin
 * @Date: 2024/11/5 17:06
 * @Version: 1.0
 * @Department: 人工智能与仿真实验室
 * @Copyright: Copyright By AI&Simulation Lab, All Rights Reserved
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @File: SwaggerConfig
 * @Brief: 购票微服务端的配置类
 * @Details:
 * @Author: Kevin
 * @Date: 2024/11/5 16:58
 * @Version: 1.0
 * @Department: 人工智能与仿真实验室
 * @Copyright: Copyright By AI&Simulation Lab, All Rights Reserved
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket buildDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(buildApiInf()) // .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage(""))// 需要生成文档的包的位置
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo buildApiInf() {
        return new ApiInfoBuilder()
                .title("用户接口详情")
                .description("Zuul+Swagger2构建RESTful APIs")
                .version("1.0")
                .build();
    }
}


